package com.sleep.psy.external_server.business.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sleep.psy.external_server.business.sys.entity.SysModule;
import com.sleep.psy.external_server.business.sys.mapper.SysModuleMapper;
import com.sleep.psy.external_server.business.sys.service.SysModuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sleep.psy.external_server.constants.MySqlConstant;
import com.sleep.psy.external_server.result.Result;
import com.sleep.psy.external_server.result.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * App底栏配置表 服务实现类
 * </p>
 *
 * @author wenliguo
 * @since 2025-08-20
 */
@Service
public class SysModuleServiceImpl extends ServiceImpl<SysModuleMapper, SysModule> implements SysModuleService {

    @Autowired
    private SysModuleMapper moduleMapper;

    /**
     * 查询有效的底栏配置
     * @author wenliguo
     * @date 2025/8/20 10:52
     * @return com.sleep.psy.external_server.result.Result
     */
    @Override
    public Result selectModule() {
        QueryWrapper<SysModule> wrapper = new QueryWrapper<>();
        wrapper.eq("status", MySqlConstant.STATUS_1)
                .orderByAsc("sort_num");
        return ResultUtil.success(moduleMapper.selectList(wrapper));
    }
}
